"ui";



ui.layout(
    <drawer id="drawer">
    <vertical>
        <appbar>
            <toolbar id="toolbar" title="脚本all in one"/>
            <tabs id="tabs"/>
        </appbar>
        <viewpager id="viewpager">
            <frame>
                <vertical>
                    
                    <text textSize="18sp" padding="8" bg="#FF00FF" margin = "5" gravity="center" alpha="0.5" textColor="white">专用模块</text>
                    <horizontal padding="16">
                    <text textSize="16sp" textColor="black" text="请输入脚本名称："/>
                    <input id="script" w="180" text="game/hb"/>
                    </horizontal> 
                    <text textSize="19sp" textColor="blue" text="文件夹：game"/>
                    <text textSize="16sp" textColor="black" text="hb.js wdcs.js xprpk.js"/>
                    <text textSize="19sp" textColor="blue" text="main分支:"/>
                    <text textSize="16sp" textColor="black" text="diantaonew.js jckd.js jdrdxj.js"/>
                    <text textSize="16sp" textColor="black" text="jzsdq.js kuaishou.js lookscan.js"/>
                    <text textSize="16sp" textColor="black" text="lw.js lwxy.js main.js read.js zfbdaily.js"/>
                    <button id="ok" text="开始"/> 
                </vertical>
            </frame>
        </viewpager>
    </vertical>
</drawer>
)

ui.ok.click(function() {
    threads.start(function(){
        main()
    })
})

function main(){
    var script = ui.script.getText() //获取脚本名称
    var start = "https://gitee.com/fridayon/test/raw/main/" + script + ".js"
    sleep(1000)
    console.log(start)
    var myEngine = engines.myEngine()
    引入脚本(start)
    engines.execScript('运行云脚本', list)
    myEngine.forceStop()
}
function 引入脚本(url) {
    var res = http.get(url)
    list = res.body.string() //脚本文字
    return list
}
